package com.whucke.multi.datasource.controller;

import com.whucke.multi.datasource.domain.User;
import com.whucke.multi.datasource.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * User Controller
 *
 * @author zhang peng
 * @since 2019/3/6 10:18
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/save")
    public Object saveUser(String name, Integer age) {
        User user = userService.save(name, age);
        return user.getId();
    }
}

